# -*- coding: utf-8 -*-
'''
Created on 18/06/2012

@author: rcasal
'''

from domain.forms.sqlforms import FormFactory

if 0:
    None
    import gluon
    import gluon.languages.translator as T
    global response; response = gluon.globals.Response()
    from repositories.sigecon.usuario import AuthRepository as auth
    
@auth.requires_login()  
@auth.requires_membership("SISTEMAS") 
def register():

    form = FormFactory.alta_usuarios(auth.get_table_user())
    
    if form.process().accepted:
        try:
            auth.save_user(form.vars)
            response.flash=T('Thanks for filling the form')
        except Exception as inst:
            response.flash= inst.args
    
    return dict(title = "Registro de Usuarios", form = form)
    
    